package com.stm.bi.repository.ods;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.stm.bi.dto.query.ods.OdsListQry;
import com.stm.bi.jdbc.DataSourceEnum;
import com.stm.bi.jdbc.DataSourceSwitch;
import com.stm.bi.repository.dataobject.ods.OdsWarehouseDO;
import com.stm.bi.repository.mapper.ods.OdsWarehouseMapper;
import com.stm.framework.core.util.StringUtil;
import com.stm.framework.repository.BaseRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class OdsWarehouseRepository extends BaseRepository<OdsWarehouseMapper, OdsWarehouseDO, OdsWarehouseDO> {


    public List<OdsWarehouseDO> selectList(OdsListQry qry){

        LambdaQueryWrapper<OdsWarehouseDO> queryWrapper = Wrappers.<OdsWarehouseDO>lambdaQuery()
                .eq(StringUtil.isNotEmpty(qry.getOrgNo()), OdsWarehouseDO::getOrgNo, qry.getOrgNo())
                .eq(StringUtil.isNotEmpty(qry.getOrgId()), OdsWarehouseDO::getOrgId, qry.getOrgId());

        return this.baseMapper.selectList(queryWrapper);
    }
}
